<?php

class PhpFox_Mod_Account_ComponentAdminMemberships extends BaseComponent
{
    /** Processing method
     */
	function process()
	{
		$aItemsSpecial = array();
		$aItems = array();
		$aMems = $this->oDatabase->getRows("SELECT m.*, COUNT(id) AS total FROM
			". App::getT('membership') ." AS m
			LEFT JOIN ". App::getT('user') ." AS u ON(m.membership_id = u.type)
			GROUP BY m.membership_id
			ORDER BY m.membership_id DESC");

		foreach($aMems as $aMem)
		{
			if ( $aMem['is_special'] )
			{
				$aItemsSpecial[] = $aMem;
			}
			else
			{
				$aItems[] = $aMem;
			}
		}

		$this->oTpl->assign(array
		(
			'aItemsSpecial' => $aItemsSpecial,
			'aItems' => $aItems,
		));


		return $this->oTpl->fetch('AdminMemberships.html');
	}
}

?>